package com.cyanite.playlv2api.parsers.json;

import com.cyanite.playlv2api.types.TripMini;

import org.json.JSONException;
import org.json.JSONObject;

public class TripMiniParser extends AbstractParser<TripMini> {

    @Override
    public TripMini parse(JSONObject json) throws JSONException {

        TripMini obj = new TripMini();
        if (json.has("tid")) {
            obj.setId(String.valueOf(json.getInt("tid")));
        }
        if (json.has("name")) {
            obj.setName(json.getString("name"));
        }
        if (json.has("photo")) {
            obj.setPhoto(json.getString("photo"));
        }
        return obj;
    }
}